<script>
<!--
$(document).ready (function() {
	
	// intialize validator plug-in for form
	$("#contactus_form").validate();

	$.extend($.validator.messages, {
	});
	
	// preventing from submiting normal request. always return false.
	$('form#contactus_form').submit(function(){
		return false; 
	});
	
	// attached submit button on click event handler
	$('form#contactus_form input#submit').click(function() {
	
		// client side form validation
		if($("#contactus_form").valid() == false){
			return false;
		}
		
		// prepare post data in JSON format
		postData = $('form#contactus_form').serializeObject();	
		
		// make an AJAX request to get data 
		$('div.inprocess').html('<img src="'+ conf['public_url'] +'/image/ajax-loader.gif">');
		
		$.ajax(
		{
			url: conf['base_url']+'/index.php/contactus_controller/ajax_add_contactus/',
			type: 'POST',
			data:{'request_data': JSON.stringify(postData)},
			dataType : 'json',
			success: function(data) 
			{
				ajax_add_success(data);
			},
			error: function(xhr, ajaxOptions, thrownError)
			{
				ajax_add_error(xhr, ajaxOptions, thrownError);
			}
		});
	});
	
	
	
});



// call on HTTP request success 
function ajax_add_success(data)
{
	$('div.inprocess').empty();
	$('form#contactus_form div.error').html('');
	$('div.form_body').hide();
	$('div.success').show();
	
}

// call on HTTP request error
function ajax_add_error(xhr, ajaxOptions, thrownError)
{
	$('div.inprocess').empty();
	$('form#contactus_form div.error').html('Ooops we can not sent your comments right now. Please try later.');
}

-->
</script>
<div class="list_heading"><h2>Contact Us</h2></div>
<div id="contact-us" class="staticPageBox">
	<div class="inprocess"></div>
	<div class="form_body">
		<form id="contactus_form">
			<div class="error"></div>
			<div class="field">
				<div class="label">Subject (Required)</div>
				<div class="control"><input type="text" name="subject" size="50" maxlength="100" class="required"></div>
			</div>
			<div class="field">
				<div class="label">Email (Required)</div>
				<div class="control"><input type="text" name="email" size="50" maxlength="100" class="required email"></div>
			</div>
			<div class="field">
				<div class="label">Comment (Required)</div>
				<div class="control"><textarea name="comment" rows="5" cols="40" class="required"></textarea></div>
			</div>
			
			<div class="field">
				<div class="control"><input class="submit" id="submit" type="submit" value="Submit"/></div>
			</div>
		</form>
	</div>	
	<div class="success" style="display:none;">
		Thank you for contacting us!<br/>
		Your information has been sent and we should be in touch with you soon.
	</div>
</div>